package service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import pojo.HospitalBed;
import service.HospitalBedService;
import dao.HospitalBedMapper;

import java.util.List;

@Service
public class HospitalBedServiceImpl implements HospitalBedService {

    @Autowired
    private HospitalBedMapper hospitalBedMapper;

    @Override
    public List<HospitalBed> findAllHospitalBeds() {
        return hospitalBedMapper.findAllHospitalBeds();
    }

    @Override
    public HospitalBed findHospitalBedById(Integer id) {
        return hospitalBedMapper.findHospitalBedById(id);
    }

    @Override
    public void saveHospitalBed(HospitalBed hospitalBed) {
        hospitalBedMapper.insertHospitalBed(hospitalBed);
    }

    @Override
    public void updateHospitalBed(HospitalBed hospitalBed) {
        hospitalBedMapper.updateHospitalBed(hospitalBed);
    }

    @Override
    public void deleteHospitalBed(Integer id) {
        hospitalBedMapper.deleteHospitalBed(id);
    }

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/uploads/**")
                .addResourceLocations("file:D:/uploads/");
    }
}
